package com.ruoyi.fn.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.fn.mapper.FinCategoryMapper;
import com.ruoyi.fn.domain.FinCategory;
import com.ruoyi.fn.service.IFinCategoryService;
import com.ruoyi.common.core.text.Convert;

/**
 * 收支分类Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-05-26
 */
@Service
public class FinCategoryServiceImpl implements IFinCategoryService 
{
    @Autowired
    private FinCategoryMapper finCategoryMapper;

    /**
     * 查询收支分类
     * 
     * @param categoryId 收支分类主键
     * @return 收支分类
     */
    @Override
    public FinCategory selectFinCategoryByCategoryId(Long categoryId)
    {
        return finCategoryMapper.selectFinCategoryByCategoryId(categoryId);
    }

    /**
     * 查询收支分类列表
     * 
     * @param finCategory 收支分类
     * @return 收支分类
     */
    @Override
    public List<FinCategory> selectFinCategoryList(FinCategory finCategory)
    {
        return finCategoryMapper.selectFinCategoryList(finCategory);
    }

    /**
     * 新增收支分类
     * 
     * @param finCategory 收支分类
     * @return 结果
     */
    @Override
    public int insertFinCategory(FinCategory finCategory)
    {
        finCategory.setCreateTime(DateUtils.getNowDate());
        return finCategoryMapper.insertFinCategory(finCategory);
    }

    /**
     * 修改收支分类
     * 
     * @param finCategory 收支分类
     * @return 结果
     */
    @Override
    public int updateFinCategory(FinCategory finCategory)
    {
        finCategory.setUpdateTime(DateUtils.getNowDate());
        return finCategoryMapper.updateFinCategory(finCategory);
    }

    /**
     * 批量删除收支分类
     * 
     * @param categoryIds 需要删除的收支分类主键
     * @return 结果
     */
    @Override
    public int deleteFinCategoryByCategoryIds(String categoryIds)
    {
        return finCategoryMapper.deleteFinCategoryByCategoryIds(Convert.toStrArray(categoryIds));
    }

    /**
     * 删除收支分类信息
     * 
     * @param categoryId 收支分类主键
     * @return 结果
     */
    @Override
    public int deleteFinCategoryByCategoryId(Long categoryId)
    {
        return finCategoryMapper.deleteFinCategoryByCategoryId(categoryId);
    }
}
